/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/*
 * PImgCerrar.java
 *
 * Created on 05-oct-2011, 11:38:48
 */
package MainWindows;
import java.awt.*;
import java.awt.image.BufferedImage;
import java.io.*;
import javax.imageio.ImageIO;
/**
 *
 * @author Michael
 */
public class PImgCerrar extends javax.swing.JPanel {
    BufferedImage offScreen = null;
    BufferedImage backGround = null;
    public PImgCerrar(FPantallaPrincipal padre) {
        initComponents();
        //this.setSize(29,29);
        this.setBounds(padre.getWidth()-(29+3),3 , 29, 29);
        try {
            backGround = ImageIO.read(getClass().getResource("/resources/cerrar.png"));
        } 
        catch (
            IOException e) {e.printStackTrace();
        }
    }
    public void paintComponent(Graphics g) {
        Dimension tamanio = getSize();
        offScreen = (BufferedImage) createImage(tamanio.width,tamanio.height);        
        offScreen.getGraphics().drawImage(backGround, 0, 0, tamanio.width, tamanio.height,new Color(255, 213, 27), this);

        g.drawImage(offScreen,0,0,this);
        setOpaque(false);
        //super.paintComponent(g);
    }

    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
        this.setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGap(0, 400, Short.MAX_VALUE)
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGap(0, 300, Short.MAX_VALUE)
        );
    }// </editor-fold>//GEN-END:initComponents
    // Variables declaration - do not modify//GEN-BEGIN:variables
    // End of variables declaration//GEN-END:variables
}
